import Mock from 'mockjs'

const { Random } = Mock

const getList = {
  url: 'mock/test/getList',
  type: 'get',
  response: config => {
    let list = Array.from(new Array(10), () => '')
      .map(() => {
        return {
          title: Random.ctitle(),
          content: Random.cparagraph(),
          createTime: Random.date()
        }
      })
    return {
      code: 200,
      data: list
    }
  }
}

const addItem = {
  url: 'mock/test/addItem',
  type: 'post',
  response: config => {
    return {
      code: 200
    }
  }
}

export default [
  getList,
  addItem
]
